home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun: Strategy Games 1
/
rerun-strategygamesI.d64
/
chummy checker
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
5KB
|
208 lines
2 printchr$(147)"would you like instructions (y/n)?
4 [161] a$: [139] a$[179][177] "y" [175] a$[179][177]"n" [167] 4
6 [139] a$[178]"n" [167] 70
8 [153]"instructions on screen or printer (s/p)?
10 get b$: if b$<> "s" and b$<>"p" then 10
12 if b$="s"then d=3
14 if b$="p" then d=4
16 open d,d
18 print#d,"
20 [152]d,"chummy checkers by tony brantner
24 print#d,"run it right: c-64; joystick
26 [152]d,"
28 print#d,"in this game, as in traditional
30 [152]d,"checkers, players must clear each
32 print#d,"other's pieces from the game by jumping
34 [152]d,"them. you can play against another
36 print#d,"person, against the computer, or watch
38 [152]d,"the computer play itself. a single joy-
40 print#d,"stick in port 2 controls both sides.
42 [152]d,"
44 print#d,"moving a piece involves two steps.
46 [152]d,"first, use the joystick to position the
48 print#d,"flashing yellow cursor over the piece
50 [152]d,"you want to move and press the fire-
52 print#d,"button. when a piece reaches your
54 [152]d,"opponent's back row it is kinged, and
56 print#d,"can move either forward or backward.
58 [152]d,"until then, it can only move forward.
60 print#d,"
62 [152]d,"enter zero as the number of players to
64 print#d,"put the computer in auto-play mode. f1
66 [152]d,"ends the game.
68 closed
70 print"press any key to begin the program..."
72 get e$:if e$="" then 72
74 clr
76 rem---checkers
78 poke52,56:poke56,56:clr
80 gosub372
82 v=53248:s1=54272:s2=s1+7:sc=1024:tc=646:a=rnd(-ti)
84 fora=1to38:sp$=sp$+chr$(32):next
86 dim bd(63),ch(1),mv$(1),d(1,3),tl(1),pl(1)
88 forz=0to63:bd(z)=sc+168+int(z/8)*80+(zand7)*3:next
90 ch(0)=163:ch(1)=171
92 mv$(0)=left$(sp$,4):mv$(1)="move"
94 d(0,0)=7:d(0,1)=9:d(0,2)=-7:d(0,3)=-9
96 fora=0to3:d(1,a)=-d(0,a):next
98 pokev+39,7:pokev+40,2
100 poke2040,13:poke2041,14
102 fora=s1tos1+24:pokea,0:next
104 pokes1+1,37:pokes1+5,9
106 pokes2+1,5:pokes2+5,8:pokes2+6,240:pokes1+24,15
108 gosub278
110 p1=0
112 rem---main
114 p2=p1:p1=1-p1:m=0
116 cy=10:cx=2:gosub354:poketc,1:printmv$(p1)
118 cx=34:gosub354:poketc,0:printmv$(p2)
120 ifpl(p1)then144
122 rem---computer
124 m1=1:forzz=0to63
126 ifpeek(bd(zz))=ch(p1)thengosub242
128 next:ifm1=1then192
130 ifm1<6thengosub228:goto138
132 gosub220:iftl(p2)=0then192
134 m1=1:zz=qd:gosub242
136 ifm1>=6then132
138 geta$:ifa$=chr$(133)then192
140 goto114
142 rem---player
144 r=p1*7:c=r:pokev+3,0
146 gosub200:ifa$=chr$(133)then192
148 ifpeek(l)<>ch(p1)then146
150 k=-(peek(l+1)=166)
152 pokev+2,peek(v):pokev+16,(peek(v+16)and1)*3:pokev+3,peek(v+1)
154 rf=r:cf=c:lf=l
156 gosub200:ifa$=chr$(133)then192
158 rem---test
160 ifr=rfandc=cfthen156
162 ifpeek(l)<>160then180
164 rm=rf-r:cm=cf-c:ifabs(rm)<>abs(cm)then180
166 ifk=0andsgn(rm)<>sgn(p1-.5)then180
168 ifabs(rm)=1andm=0thengosub228:goto114
170 ifabs(rm)<>2then180
172 rj=rf-rm/2:cj=cf-cm/2
174 lj=bd(rj*8+cj)
176 ifpeek(lj)=ch(p2)then188
178 rem---illegal move
180 ifmthen114
182 pokes2+4,33:fora=1to200:next
184 pokes2+4,32:goto144
186 rem---jump checker
188 gosub220:iftl(p2)then152
190 rem---end of game
192 q$="play again? [y/n] ":se$="yn":gosub326
194 ifa$="y"then108
196 poke832,0:sys832
198 rem---joystick
200 js=peek(56320)
202 geta$:ifa$=chr$(133)thenreturn
204 r=r+sgn(jsand1)-sgn(jsand2)and7
206 c=c+sgn(jsand4)-sgn(jsand8)and7
208 pokev,88+c*24and255:pokev+16,(peek(v+16)and2)-(c=7)
210 pokev+1,82+r*16
212 pokev+21,3:fora=1to90:next:pokev+21,0
214 ifjsand16then200
216 l=bd(r*8+c):return
218 rem---jump
220 fora=0to2
222 pokelj+a,160:pokelj+40+a,160:next
224 m=m+1:tl(p2)=tl(p2)-1:gosub314
226 rem---move
228 forz=0to2:pokel+z+s1,p1:pokel+40+z+s1,p1
230 pokel+z,peek(lf+z):pokel+40+z,peek(lf+40+z)
232 pokelf+z,160:pokelf+40+z,160:next
234 ifr=7orr=0thenk=1:pokel+1,166:pokel+41,167
236 pokes1+4,16:pokes1+4,17
238 return
240 rem---find computer move
242 kd=-(peek(bd(zz)+1)=166)
244 fordr=0to1+kd*2:m0=0
246 d=zz+d(p1,dr):ifd<0ord>63then274
248 f1=peek(bd(d)):f2=0:dj=d
250 d=d+d(p1,dr):ifd<0ord>63then254
252 f2=peek(bd(d))
254 iff1<>160then264
256 m0=2:d=dj:iff2<>ch(p2)thenm0=3
258 iff2=ch(p1)thenm0=4
260 if(d<8ord>55)andkd=0thenm0=5
262 goto270
264 iff1<>ch(p2)orf2<>160then274
266 m0=6:ifpeek(bd(dj)+1)=166thenm0=7
268 if(d<8ord>55)andkd=0thenm0=8
270 m0=m0+rnd(1)
272 ifm0>m1thenm1=m0:l=bd(d):lf=bd(zz):lj=bd(dj):r=int(d/8):qd=d
274 next:return
276 rem---screen
278 pokev+21,0:printchr$(147):poketc,1
280 printtab(15)" checkers ":zz=96
282 fora=0to63:forz=0to2
284 pokebd(a)+z,zz:pokebd(a)+40+z,zz
286 next
288 if(aand7)<7thenzz=160+(zz=160)*64
290 next
292 poketc,0:a$="#"
294 fora=1to3:gosub360:next
296 poketc,1:a$="+"
298 fora=6to8:gosub360:next
300 rem---get players
302 q$="players [0,1 or 2] ":se$="012":gosub326
304 pl(0)=0:pl(1)=0:a=val(a$)
306 ifathenpl(1)=1:pl(0)=a-1
308 cy=22:cx=9:gosub354:print"press f1 [146] to end game"
310 tl(0)=12:tl(1)=12
312 rem---print totals
314 cy=12:cx=3:a=1:gosub318
316 cx=35:a=0
318 gosub354:poketc,a
320 printright$(str$(tl(a)),2)
322 return
324 rem---get key
326 cy=22:gosub348
328 cx=(40-len(q$))/2:gosub354
330 poketc,1:printq$;
332 poke198,0:poke204,0
334 wait198,15:geta$:z=len(se$)
336 ifa$=mid$(se$,z,1)then342
338 z=z-1:ifzthen336
340 goto334
342 poke204,1:printa$
344 fora=1to500:next
346 rem---clear line
348 poke214,cy-1:print:printsp$
350 return
352 rem---plot
354 poke214,cy-1:print:printtab(cx);
356 return
358 rem---print checkers
360 cy=2+a*2:cx=8+(aand1)*3:gosub354
362 forz=0to3
364 printchr$(18);a$;"$%[157][157][157]*)([145]";
366 next
368 return
370 rem---initialize
372 printchr$(8)chr$(147)
374 poke56334,peek(56334)and254
376 poke1,peek(1)and251
378 fora=0to511:poke14336+a,peek(53248+a):next
380 poke1,peek(1)or4
382 poke56334,peek(56334)or1
384 poke53272,(peek(53272)and240)or14
386 fora=0to31:readz:poke14616+a,z:poke14616+63-a,z:next
388 fora=0to7:poke14616+64+a,peek(14616+a):next
390 poke53280,7:poke53281,15
392 poke53282,10:poke53283,2
394 poke53265,peek(53265)or64
396 rem---sprite cursors
398 fora=832to959:pokea,0:next
400 fora=835to874step3:pokea,192:pokea+2,3:next
402 fora=0to2:poke832+a,255:poke877+a,255:next
404 fora=896to943:pokea,255:next
406 return
408 rem---character data
410 data0,0,0,3,7,15,15,31
412 data0,0,255,255,255,255,255,255
414 data0,0,0,192,224,240,240,248
416 data0,0,255,255,255,153,147,135